﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DotabuffWebAPI
{
    /// <summary>
    /// Informace o hráči
    /// </summary>
    [Serializable()]
    public class PlayerInfo
    {
        private int wins;
        private int loss;
        private string id;

        [System.Xml.Serialization.XmlElement("Won")]
        public int Wins
        {
            get { return this.wins;}
            set { this.wins = value; }
        }

        [System.Xml.Serialization.XmlElement("Lost")]
        public int Loss
        {
            get { return this.loss; }
            set { this.loss = value; }
        }
        
        [System.Xml.Serialization.XmlIgnore]
        public double Winrate
        {
            get 
            {
                if (wins != 0 && loss != 0)
                {
                    return (wins / (double)(wins + loss));
                }
                else
                {
                    return 0;
                }
            }
        }

        public PlayerInfo()
        {

        }

        public PlayerInfo(string steamID)
        {
            this.id = steamID;
        }
    }
}
